#include"Task.hpp"
#include "Threadpool.hpp"
#include <iostream>
#include <memory>
#include <ctime>


//主线程获取任务
int main()
{
    sleep(10);
    srand(time(nullptr));
    // shared_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    // tp->Start();   

    ThreadPool<Task>::GetInstance()->Start();
    while (true)
    {
        int x = rand() % 100 + 1;
        usleep(1234);
        int y = rand() % 200;
        usleep(1234);
        char oper = opers[rand() % opers.size()];

        Task t(x, y, oper);
        ThreadPool<Task>::GetInstance()->Push(t);
        sleep(1);
    }
    ThreadPool<Task>::GetInstance()->Wait();
    return 0;
}